package cn.renhui.hermesbus;

import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;

import cn.renhui.hermesbus.core.Hermes;
import cn.renhui.hermesbus.core.HermesService;

public class SecondActivity extends AppCompatActivity {

    IUserManager userManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);

        Hermes.getDefault().connectApp(this, HermesService.class);
    }


    public void sendMessage(View view) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                userManager.setStudent(new Student("maomao", 28));
            }
        }).start();
    }

    public void getServiceUserManager(View view) {
        userManager = Hermes.getDefault().getInstance(IUserManager.class);
    }
}